package com.itheima_03;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class CopyJavaDemo02 {
    public static void main(String[] args) throws IOException {
        //根据数据源创建字符输入流对象
        FileReader fr = new FileReader("myCharStream\\ConvrsionStreamDemo.java");
        //根据数据源创建字符输出流对象
        FileWriter fw = new FileWriter("myCharStream\\Copy.txt");

        //读写数据，复制文件
        /*
        int ch;
        while ((ch = fr.read())!=-1){
            fw.write(ch);
        }
         */

        char[] chs = new char[1024];
        int len;
        while ((len=fr.read(chs))!=-1){
            fw.write(chs,0,len);
        }


        //释放资源
        fr.close();
        fw.close();
    }
}
